<?php
require_once('dataManager/DataManager.php');
require_once('dataManager/definitions.php');

 $g_dbM1 = new DataManager("root", "amazon", "localhost", NB_DATABASE_ADMIN);
 $g_dbM2 = new DataManager("root", "amazon", "localhost", NB_DATABASE_COLLECTOR);

 $g_dbM1->selectAllFromTable(NB_ADMIN_TABLE_STREAMS, "");
 if($g_dbM1 && $g_dbM2)
 {
   while($data = $g_dbM1->retrieveResult())
   {
    //echo $data[NB_ADMIN_STREAMS_COLUMN_SID]."-".$data[NB_ADMIN_STREAMS_COLUMN_DATATYPE]."<br>";
 	$g_dbM2->selectAllFromTable(NB_COLLECTOR_TABLE_DATA_PREFIX.$data[NB_ADMIN_STREAMS_COLUMN_SID],
 								"1=1 ORDER BY id DESC LIMIT 1");
	while($data2 = $g_dbM2->retrieveResult())
	{
		echo "Sid:".$data[NB_ADMIN_STREAMS_COLUMN_SID]." | data:".$data2[NB_COLLECTOR_DATA_COLUMN_VALUE]." | time:".$data2[NB_GENERAL_COLUMN_TIMESTAMP]."<br>";
	}
   }
 }

?>
